package cn.xyfmzmy.chain.validation;


import cn.xyfmzmy.chain.exception.ValidationException;

public class MinValidateHandler implements ValidateHandler{

    private final int min;

    public MinValidateHandler(int min) {
        this.min = min;
    }

    @Override
    public void validate(Object value,ValidateContext validateContext) {
        if(value instanceof Integer intValue){
            if(intValue < min){
                validateContext.appendError("你的值是" + intValue + "不能小于" + min);
            }
        }
    }
}
